import QtQuick
import QtQuick.Controls
Page {
    property string tabbarname
    property string names
    property bool isVisibleOfVersionControl
    property bool isVisibleOfVersion

    property string mains
    property string minors
    property string revisions

    Column{
        width: parent.width*0.93
        height: parent.height*0.93
        anchors.centerIn: parent
        ScrollView{
            width: parent.width
            height: parent.height*0.79
            Column{
                width: parent.width
                spacing:5
                Row{
                    spacing:5
                    width:parent.width
                    height: 50
                    Rectangle{
                        height:parent.height-10
                        width:parent.width
                        Text {
                            font.pixelSize: 20
                            anchors.fill: parent
                            text: tabbarname
                            verticalAlignment: Text.AlignVCenter
                            horizontalAlignment: Text.AlignHCenter
                        }
                    }

                }


                Row{
                    spacing:5
                    width:parent.width
                    height: 50
                    Rectangle{
                        height:parent.height-10
                        width:parent.width*0.3
                        Text {
                            font.pixelSize: 15
                            anchors.fill: parent
                            text: "名称"
                            verticalAlignment: Text.AlignVCenter
                            horizontalAlignment: Text.AlignHCenter
                        }
                    }
                    TextField{
                        id:textfield_name
                        height:parent.height-10
                        width:parent.width*0.67
                        placeholderText: "名称"
                        Material.accent: Material.Blue
                        text: names
                    }
                }
                Row{
                    visible: isVisibleOfVersionControl||isVisibleOfVersion
                    spacing:5
                    width:parent.width
                    height: 50
                    Rectangle{
                        height:parent.height-10
                        width:parent.width*0.3
                        Text {
                            font.pixelSize: 15
                            anchors.fill: parent
                            text: "主版本号"
                            verticalAlignment: Text.AlignVCenter
                            horizontalAlignment: Text.AlignHCenter
                        }
                    }
                    TextField{
                        text: mains
                        id:textfield_main
                        height:parent.height-10
                        width:parent.width*0.67
                        placeholderText: "主版本号"
                        Material.accent: Material.Blue
                    }
                }
                Row{
                    visible:  isVisibleOfVersionControl||isVisibleOfVersion
                    spacing:5
                    width:parent.width
                    height: 50
                    Rectangle{
                        height:parent.height-10
                        width:parent.width*0.3
                        Text {
                            font.pixelSize: 15
                            anchors.fill: parent
                            text: "次版本号"
                            verticalAlignment: Text.AlignVCenter
                            horizontalAlignment: Text.AlignHCenter
                        }
                    }
                    TextField{
                        text: minors
                        id:textfield_minor
                        height:parent.height-10
                        width:parent.width*0.67
                        placeholderText: "次版本号"
                        Material.accent: Material.Blue
                    }
                }
                Row{
                    visible: isVisibleOfVersion
                    spacing:5
                    width:parent.width
                    height: 50
                    Rectangle{
                        height:parent.height-10
                        width:parent.width*0.3
                        Text {
                            font.pixelSize: 15
                            anchors.fill: parent
                            text: "修正号"
                            verticalAlignment: Text.AlignVCenter
                            horizontalAlignment: Text.AlignHCenter
                        }
                    }
                    TextField{
                        text: revisions
                        id:textfield_revision
                        height:parent.height-10
                        width:parent.width*0.67
                        placeholderText: "修正号"
                        Material.accent: Material.Blue
                    }
                }

            }

        }
        Button{
            width: parent.width
            height: parent.height*0.1
            Material.roundedScale: Material.SmallScale
            Material.accent: Material.Blue
            highlighted: true
            text:"确定修改"
            onClicked: {
                editfun(textfield_name.text)
                if(isVisibleOfVersionControl){
                    editfun_versioncontrol(textfield_main.text,
                                           textfield_minor.text
                                           )
                }
                if(isVisibleOfVersion){
                    editfun_version(textfield_revision.text)
                    editfun_versioncontrol(textfield_main.text,
                                           textfield_minor.text
                                           )
                }
            }
        }
    }

    signal editfun(var name);
    signal editfun_versioncontrol(var main,var minor)
    signal editfun_version(var rivision)



}
